package com.zdb.demo.design.pattern.behavioral.chainofresponsibility.demo1.before;

public class FeeRequest {

    public String requestToProjectManager(String user, double fee) {
        String str = "";
        if(fee < 500) {
            // 项目经理审批，费用小于500
            str = this.projectHandle(user, fee);
        } else if(fee < 1000) {
            // 项目经理审批，费用小于500
            str = this.depManagerHandle(user, fee);
        } else if(fee >= 1000) {
            str = this.generalManagerHandle(user, fee);
        }

        return str;
    }

    private String generalManagerHandle(String user, double fee) {
        String str = "";
        if("小李".equals(user)) {
            str = String.format("总经理【同意】%s聚餐费用%f元的请求", user, fee);
        } else {
            str = String.format("总经理【不同意】%s聚餐费用%f元的请求", user, fee);
        }
        return str;
    }

    private String depManagerHandle(String user, double fee) {
        String str = "";
        if("小李".equals(user)) {
            str = String.format("部门经理【同意】%s聚餐费用%f元的请求", user, fee);
        } else {
            str = String.format("部门经理【不同意】%s聚餐费用%f元的请求", user, fee);
        }
        return str;
    }

    private String projectHandle(String user, double fee) {
        String str = "";
        if("小李".equals(user)) {
            str = String.format("项目经理【同意】%s聚餐费用%f元的请求", user, fee);
        } else {
            str = String.format("项目经理【不同意】%s聚餐费用%f元的请求", user, fee);
        }
        return str;
    }
}
